/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vista;

import com.googlecode.charts4j.AxisLabels;
import com.googlecode.charts4j.AxisLabelsFactory;
import com.googlecode.charts4j.AxisStyle;
import com.googlecode.charts4j.AxisTextAlignment;
import com.googlecode.charts4j.Color;
import com.googlecode.charts4j.Data;
import com.googlecode.charts4j.Fills;
import com.googlecode.charts4j.GCharts;
import com.googlecode.charts4j.Line;
import com.googlecode.charts4j.LineChart;
import com.googlecode.charts4j.LineStyle;
import com.googlecode.charts4j.LinearGradientFill;
import com.googlecode.charts4j.Plots;
import com.googlecode.charts4j.Shape;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.table.DefaultTableModel;
import modelo.Tabla;
import modelo.Tablespace;

/**
 *
 * @author Andrés
 */
public final class VistaDetallesTablespaces extends javax.swing.JFrame {

    /**
     * Creates new form VistaDetalles
     */
    private List<Color> colors;
    private DefaultTableModel defaultTableModel;

    public VistaDetallesTablespaces() {
        initComponents();
        inicializarVariables();
        iniciarColores();
        setVisible(false);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setLocationRelativeTo(null);
        this.setResizable(false);
        iniciarLogo();
    }

    public final void inicializarVariables() {
        colors = new ArrayList<>();
        this.defaultTableModel = new DefaultTableModel();
        defaultTableModel = (DefaultTableModel) tablaTablas.getModel();
    }

    public void mostrar(String nombre) {
        this.setTitle("Detalles de Tablespace : " + nombre);

        setVisible(true);
    }

    public final void iniciarLogo() {
        setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("./image/logo.png")));
    }

    public void agregarListenerItemCerrar(ActionListener actionListener) {
        this.itemCerrar.addActionListener(actionListener);
    }

    public void agregarListenerItemAcerdaDe(ActionListener actionListener) {
        this.itemAcercaDe.addActionListener(actionListener);
    }

    public void agregarListaTablas(Tablespace tb, String fecha) {
        DefaultListModel model = new DefaultListModel();
        model.clear();
        if (defaultTableModel.getRowCount() > 0) {
            for (int i = defaultTableModel.getRowCount() - 1; i > -1; i--) {
                defaultTableModel.removeRow(i);
            }
        }
        ArrayList<Tabla> tbs = (ArrayList<Tabla>) tb.getDiaTablespace(fecha).get_tablas();
        for (Tabla tbl : tbs) {
            model.addElement(tbl.getNombre());
            defaultTableModel.addRow(new Object[]{tbl.getNombre(), tbl.getTamano(), tbl.getFilas()});
        }
        listaTablas.setModel(model);
        tablaTablas.repaint();
        panelTablas.setViewportView(listaTablas);
        this.repaint();
    }

    public void agregarAccionBotonMostrar(ActionListener actionListener) {
        this.botonMostrar.addActionListener(actionListener);
    }

    public String obtenerSeleccionDesde() {
        return this.seleccionDesde.getSelectedItem().toString();
    }

    public String obtenerSeleccionHasta() {
        return this.seleccionHasta.getSelectedItem().toString();
    }

    public void agregarOpcionesFechas(List<String> dias) {
        this.seleccionDesde.removeAllItems();
        this.seleccionHasta.removeAllItems();
        for (int i = 0; i < dias.size(); i++) {
            if (i < dias.size() - 1) {
                this.seleccionDesde.addItem(dias.get(i));
            }
            if (i > 0) {
                this.seleccionHasta.addItem(dias.get(i));
            }
        }
    }

    public void pintarGrafico(Tablespace tb) throws MalformedURLException {

        int NUM_POINTS;
        if (tb.cantidadDias() % 5 != 0) {
            NUM_POINTS = tb.cantidadDias();
        } else {
            NUM_POINTS = 5;
        }
        final double[] mywebsite = new double[NUM_POINTS];
        for (int i = 0; i < NUM_POINTS; i++) {
            mywebsite[i] = 100 - tb.getDiaTablespace(i).getPctj_libre();
            System.out.println(tb.getDiaTablespace(i).getPctj_libre());
        }
        Line line1 = Plots.newLine(Data.newData(mywebsite), Color.newColor("CA3D05"), "% Usado");
        line1.setLineStyle(LineStyle.newLineStyle(3, 1, 0));
        line1.addShapeMarkers(Shape.DIAMOND, Color.newColor("CA3D05"), 12);
        line1.addShapeMarkers(Shape.DIAMOND, Color.WHITE, 8);


        // Defining chart.
        LineChart chart = GCharts.newLineChart(line1);
        chart.setSize(600, 450);
        chart.setTitle("% Usado de Tablespace| en días", Color.WHITE, 14);
        int rangoCritico = tb.getRango();
        System.out.println(tb.getNombre() + " - - -" + tb.getRango());
        int rango_max = 100;
        int rango_min = 0;
        int rango_esta = 25;
        int rango_mod = rangoCritico - rango_esta;
        rango_mod += rango_esta;

        chart.addHorizontalRangeMarker(rango_min, rango_esta, Color.newColor(Color.GREEN, 30));
        chart.addHorizontalRangeMarker(rango_esta, rango_mod, Color.newColor(Color.YELLOW, 30));
        chart.addHorizontalRangeMarker(rangoCritico, rango_max, Color.newColor(Color.RED, 30));
        chart.setGrid(25, 25, 3, 2);

        // Defining axis info and styles
        AxisStyle axisStyle = AxisStyle.newAxisStyle(Color.WHITE, 12, AxisTextAlignment.CENTER);
        AxisLabels xAxis = AxisLabelsFactory.newAxisLabels("1", "2", "3", "Feb", "Mar", "1234", "1234", "1234", "1234");
        ArrayList<String> dias = new ArrayList<>();
        for (int i = 0; i < tb.cantidadDias(); i++) {
            //int dia = i + 1;
            dias.add(tb.getDiaTablespace(i).getFecha());
        }

        AxisLabels labels = AxisLabelsFactory.newAxisLabels(dias);
        xAxis.setAxisStyle(axisStyle);
        AxisLabels yAxis = AxisLabelsFactory.newAxisLabels("", "25", "50", "75", "100");
        AxisLabels xAxis3 = AxisLabelsFactory.newAxisLabels("Día", 50.0);
        xAxis3.setAxisStyle(AxisStyle.newAxisStyle(Color.WHITE, 14, AxisTextAlignment.CENTER));
        yAxis.setAxisStyle(axisStyle);
        AxisLabels yAxis2 = AxisLabelsFactory.newAxisLabels("%", 50.0);
        yAxis2.setAxisStyle(AxisStyle.newAxisStyle(Color.WHITE, 14, AxisTextAlignment.CENTER));
        yAxis2.setAxisStyle(axisStyle);

        // Adding axis info to chart.
        chart.addXAxisLabels(labels);
        chart.addXAxisLabels(xAxis3);
        chart.addYAxisLabels(yAxis);
        chart.addYAxisLabels(yAxis2);

        // Defining background and chart fills.
        chart.setBackgroundFill(Fills.newSolidFill(Color.newColor("1F1D1D")));
        LinearGradientFill fill = Fills.newLinearGradientFill(0, Color.newColor("363433"), 100);
        fill.addColorAndOffset(Color.newColor("2E2B2A"), 0);
        chart.setAreaFill(fill);
        String url = chart.toURLString();
        // EXAMPLE CODE END. Use this url string in your web or
        // Internet application.
        URL img = new URL(url);
        ImageIcon image = new ImageIcon(img);
        this.graficoHistoricos.setIcon(image);
    }

    public void pintarGrafico(Tablespace tb, String desde, String hasta) throws MalformedURLException {
        int NUM_POINTS = 0;
        int desdeM = 0;
        int hastaM = 0;
        for (int i = 0; i < tb.getHistorial().size(); i++) {
            if (tb.getDiaTablespace(i).getFecha().equals(desde)) {
                desdeM = i;
            }
            if (tb.getDiaTablespace(i).getFecha().equals(hasta)) {
                hastaM = i;
            }
        }

        NUM_POINTS = hastaM - desdeM;

        final double[] mywebsite = new double[NUM_POINTS];
        ArrayList<String> dias = new ArrayList<>();

        for (int j = desdeM, i = 0; j < hastaM; j++, i++) {
            mywebsite[i] = 100 - tb.getDiaTablespace(j).getPctj_libre();
            dias.add(tb.getDiaTablespace(j).getFecha());
        }
        Line line1 = Plots.newLine(Data.newData(mywebsite), Color.newColor("CA3D05"), "% Usado");

        line1.setLineStyle(LineStyle.newLineStyle(3, 1, 0));
        line1.addShapeMarkers(Shape.DIAMOND, Color.newColor("CA3D05"), 12);
        line1.addShapeMarkers(Shape.DIAMOND, Color.WHITE,
                8);


        // Defining chart.
        LineChart chart = GCharts.newLineChart(line1);

        chart.setSize(600, 450);
        chart.setTitle("% Usado de Tablespace| en días", Color.WHITE, 14);
        int rangoCritico = tb.getRango();
        int rango_max = 100;
        int rango_min = 0;
        int rango_esta = 25;
        int rango_mod = rangoCritico - rango_esta;
        rango_mod += rango_esta;

        chart.addHorizontalRangeMarker(rango_min, rango_esta, Color.newColor(Color.GREEN, 30));
        chart.addHorizontalRangeMarker(rango_esta, rango_mod, Color.newColor(Color.YELLOW, 30));
        chart.addHorizontalRangeMarker(rangoCritico, rango_max, Color.newColor(Color.RED, 30));
        chart.setGrid(25, 25, 3, 2);

        // Defining axis info and styles
        AxisStyle axisStyle = AxisStyle.newAxisStyle(Color.WHITE, 12, AxisTextAlignment.CENTER);
        AxisLabels xAxis = AxisLabelsFactory.newAxisLabels("1", "2", "3", "Feb", "Mar", "1234", "1234", "1234", "1234");

        AxisLabels labels = AxisLabelsFactory.newAxisLabels(dias);

        xAxis.setAxisStyle(axisStyle);
        AxisLabels yAxis = AxisLabelsFactory.newAxisLabels("", "25", "50", "75", "100");
        AxisLabels xAxis3 = AxisLabelsFactory.newAxisLabels("Día", 50.0);

        xAxis3.setAxisStyle(AxisStyle.newAxisStyle(Color.WHITE, 14, AxisTextAlignment.CENTER));
        yAxis.setAxisStyle(axisStyle);
        AxisLabels yAxis2 = AxisLabelsFactory.newAxisLabels("%", 50.0);

        yAxis2.setAxisStyle(AxisStyle.newAxisStyle(Color.WHITE, 14, AxisTextAlignment.CENTER));
        yAxis2.setAxisStyle(axisStyle);

        // Adding axis info to chart.
        chart.addXAxisLabels(labels);

        chart.addXAxisLabels(xAxis3);

        chart.addYAxisLabels(yAxis);

        chart.addYAxisLabels(yAxis2);

        // Defining background and chart fills.
        chart.setBackgroundFill(Fills.newSolidFill(Color.newColor("1F1D1D")));
        LinearGradientFill fill = Fills.newLinearGradientFill(0, Color.newColor("363433"), 100);

        fill.addColorAndOffset(Color.newColor("2E2B2A"), 0);
        chart.setAreaFill(fill);
        String url = chart.toURLString();
        // EXAMPLE CODE END. Use this url string in your web or
        // Internet application.
        URL img = new URL(url);
        ImageIcon image = new ImageIcon(img);

        this.graficoHistoricos.setIcon(image);
        this.repaint();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelTablas = new javax.swing.JScrollPane();
        listaTablas = new javax.swing.JList();
        panelGraficos = new javax.swing.JTabbedPane();
        distribucionTablas = new javax.swing.JPanel();
        scrollTablas = new javax.swing.JScrollPane();
        tablaTablas = new javax.swing.JTable();
        Historico = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        graficoHistoricos = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        seleccionDesde = new javax.swing.JComboBox();
        seleccionHasta = new javax.swing.JComboBox();
        botonMostrar = new javax.swing.JButton();
        etiquetaDesde = new javax.swing.JLabel();
        etiquetaHasta = new javax.swing.JLabel();
        barraMenu = new javax.swing.JMenuBar();
        menuArchivo = new javax.swing.JMenu();
        itemCerrar = new javax.swing.JMenuItem();
        menuAyuda = new javax.swing.JMenu();
        itemAcercaDe = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        panelTablas.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Tablas"));

        listaTablas.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        panelTablas.setViewportView(listaTablas);

        panelGraficos.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Graficos"));

        tablaTablas.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Nombre", "Espacio por registro", "Cantidad de Registros"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        scrollTablas.setViewportView(tablaTablas);

        javax.swing.GroupLayout distribucionTablasLayout = new javax.swing.GroupLayout(distribucionTablas);
        distribucionTablas.setLayout(distribucionTablasLayout);
        distribucionTablasLayout.setHorizontalGroup(
            distribucionTablasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(distribucionTablasLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(scrollTablas, javax.swing.GroupLayout.DEFAULT_SIZE, 563, Short.MAX_VALUE)
                .addContainerGap())
        );
        distribucionTablasLayout.setVerticalGroup(
            distribucionTablasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(distribucionTablasLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(scrollTablas, javax.swing.GroupLayout.DEFAULT_SIZE, 378, Short.MAX_VALUE)
                .addContainerGap())
        );

        panelGraficos.addTab("Distribucion Tablas", distribucionTablas);

        jScrollPane1.setViewportView(graficoHistoricos);

        seleccionDesde.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        seleccionHasta.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        botonMostrar.setText("Mostrar");

        etiquetaDesde.setText("Desde:");

        etiquetaHasta.setText("Hasta:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(150, 150, 150)
                .addComponent(etiquetaDesde)
                .addGap(18, 18, 18)
                .addComponent(seleccionDesde, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(53, 53, 53)
                .addComponent(etiquetaHasta)
                .addGap(18, 18, 18)
                .addComponent(seleccionHasta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(botonMostrar)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(etiquetaDesde)
                    .addComponent(seleccionDesde, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(etiquetaHasta)
                    .addComponent(seleccionHasta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonMostrar))
                .addGap(0, 0, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout HistoricoLayout = new javax.swing.GroupLayout(Historico);
        Historico.setLayout(HistoricoLayout);
        HistoricoLayout.setHorizontalGroup(
            HistoricoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(HistoricoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(HistoricoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 563, Short.MAX_VALUE))
                .addContainerGap())
        );
        HistoricoLayout.setVerticalGroup(
            HistoricoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, HistoricoLayout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE))
        );

        panelGraficos.addTab("Historico", Historico);

        menuArchivo.setText("Archivo");

        itemCerrar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
        itemCerrar.setText("Cerrar");
        menuArchivo.add(itemCerrar);

        barraMenu.add(menuArchivo);

        menuAyuda.setText("Ayuda");

        itemAcercaDe.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
        itemAcercaDe.setText("Acerca De");
        menuAyuda.add(itemAcercaDe);

        barraMenu.add(menuAyuda);

        setJMenuBar(barraMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelTablas, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(panelGraficos)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(panelGraficos)
                    .addComponent(panelTablas))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;














                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(VistaDetallesTablespaces.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(VistaDetallesTablespaces.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(VistaDetallesTablespaces.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(VistaDetallesTablespaces.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VistaDetallesTablespaces().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Historico;
    private javax.swing.JMenuBar barraMenu;
    private javax.swing.JButton botonMostrar;
    private javax.swing.JPanel distribucionTablas;
    private javax.swing.JLabel etiquetaDesde;
    private javax.swing.JLabel etiquetaHasta;
    private javax.swing.JLabel graficoHistoricos;
    private javax.swing.JMenuItem itemAcercaDe;
    private javax.swing.JMenuItem itemCerrar;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JList listaTablas;
    private javax.swing.JMenu menuArchivo;
    private javax.swing.JMenu menuAyuda;
    private javax.swing.JTabbedPane panelGraficos;
    private javax.swing.JScrollPane panelTablas;
    private javax.swing.JScrollPane scrollTablas;
    private javax.swing.JComboBox seleccionDesde;
    private javax.swing.JComboBox seleccionHasta;
    private javax.swing.JTable tablaTablas;
    // End of variables declaration//GEN-END:variables

    public void iniciarColores() {
        colors = new ArrayList<>();
        colors.add(Color.AQUA);
        colors.add(Color.BEIGE);
        colors.add(Color.BLACK);
        colors.add(Color.BLUE);
        colors.add(Color.BROWN);
        colors.add(Color.BURLYWOOD);
        colors.add(Color.CORAL);
        colors.add(Color.CRIMSON);
        colors.add(Color.CYAN);
        colors.add(Color.DARKBLUE);
        colors.add(Color.DARKCYAN);
        colors.add(Color.DARKGRAY);
        colors.add(Color.DARKGREEN);
        colors.add(Color.DARKMAGENTA);
        colors.add(Color.DARKOLIVEGREEN);
        colors.add(Color.DARKORANGE);
        colors.add(Color.DARKORCHID);
        colors.add(Color.DARKRED);
        colors.add(Color.DARKSALMON);
        colors.add(Color.DARKSEAGREEN);
        colors.add(Color.DARKSLATEBLUE);
        colors.add(Color.DARKSLATEGRAY);
        colors.add(Color.DARKTURQUOISE);
        colors.add(Color.DEEPSKYBLUE);
        colors.add(Color.DIMGRAY);
        colors.add(Color.DODGERBLUE);
        colors.add(Color.FIREBRICK);
        colors.add(Color.FLORALWHITE);
        colors.add(Color.FORESTGREEN);
        colors.add(Color.GOLD);
        colors.add(Color.GREEN);
        colors.add(Color.GREENYELLOW);
        colors.add(Color.HONEYDEW);
        colors.add(Color.INDIANRED);
        colors.add(Color.INDIGO);
        colors.add(Color.IVORY);
        colors.add(Color.KHAKI);
        colors.add(Color.LAVENDER);
        colors.add(Color.LAWNGREEN);
        colors.add(Color.LEMONCHIFFON);
        colors.add(Color.LIGHTCORAL);
        colors.add(Color.LIGHTCYAN);
        colors.add(Color.LIGHTGREEN);
        colors.add(Color.LIGHTGREY);
        colors.add(Color.LIGHTPINK);
        colors.add(Color.LIGHTSALMON);
        colors.add(Color.LIGHTSEAGREEN);
        colors.add(Color.LIGHTSKYBLUE);
        colors.add(Color.LIGHTSLATEGRAY);
        colors.add(Color.LIGHTSTEELBLUE);
        colors.add(Color.LIGHTYELLOW);
        colors.add(Color.LIME);
        colors.add(Color.LIMEGREEN);
        colors.add(Color.LINEN);
        colors.add(Color.MAGENTA);
        colors.add(Color.MAROON);
        colors.add(Color.MEDIUMAQUAMARINE);
        colors.add(Color.MEDIUMBLUE);
        colors.add(Color.MEDIUMORCHID);
        colors.add(Color.MEDIUMPURPLE);
        colors.add(Color.MEDIUMSEAGREEN);
        colors.add(Color.MEDIUMSLATEBLUE);
        colors.add(Color.MEDIUMSPRINGGREEN);
        colors.add(Color.MEDIUMTURQUOISE);
        colors.add(Color.MEDIUMVIOLETRED);
        colors.add(Color.MIDNIGHTBLUE);
        colors.add(Color.MINTCREAM);
        colors.add(Color.MISTYROSE);
        colors.add(Color.MOCCASIN);
        colors.add(Color.NAVAJOWHITE);
        colors.add(Color.NAVY);
        colors.add(Color.OLDLACE);
        colors.add(Color.OLIVE);
        colors.add(Color.OLIVEDRAB);
        colors.add(Color.ORANGE);
        colors.add(Color.ORANGERED);
        colors.add(Color.ORCHID);
        colors.add(Color.PALEGOLDENROD);
        colors.add(Color.PALEGREEN);
        colors.add(Color.PALETURQUOISE);
        colors.add(Color.PALEVIOLETRED);
        colors.add(Color.PAPAYAWHIP);
        colors.add(Color.PEACHPUFF);
        colors.add(Color.PERU);
        colors.add(Color.PINK);
        colors.add(Color.PLUM);
        colors.add(Color.POWDERBLUE);
        colors.add(Color.PURPLE);
        colors.add(Color.RED);
        colors.add(Color.ROSYBROWN);
        colors.add(Color.ROYALBLUE);
        colors.add(Color.SADDLEBROWN);
        colors.add(Color.SALMON);
        colors.add(Color.SANDYBROWN);
        colors.add(Color.SEAGREEN);
        colors.add(Color.SEASHELL);
        colors.add(Color.SIENNA);
        colors.add(Color.SILVER);
        colors.add(Color.SKYBLUE);
        colors.add(Color.SLATEBLUE);
        colors.add(Color.SLATEGRAY);
        colors.add(Color.SNOW);
        colors.add(Color.SPRINGGREEN);
        colors.add(Color.STEELBLUE);
        colors.add(Color.TAN);
        colors.add(Color.TEAL);
        colors.add(Color.THISTLE);
        colors.add(Color.TOMATO);
        colors.add(Color.TURQUOISE);
        colors.add(Color.VIOLET);
        colors.add(Color.WHEAT);
        colors.add(Color.WHITE);
        colors.add(Color.WHITESMOKE);
        colors.add(Color.YELLOW);
        colors.add(Color.YELLOWGREEN);
    }
}
